package com.entities.projecttask.detail;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import com.core.protocols.ICustomDatasourceDelegate;
import com.core.protocols.IDescriptionViewDelegate;
import com.core.protocols.IDetailTableViewDelegate;
import com.core.protocols.IServiceLayerDelegate;
import com.core.protocols.ITabSheetDatasource;
import com.core.servicelayer.HibernateServiceLayer;
import com.core.ui.controller.base.HibernateDetailController;
import com.core.ui.customcell.TabSheetItemCell;
import com.core.utils.HibernateParameter;
import com.core.utils.KeyValueDictionary;
import com.core.utils.LocalizableString;
import com.entities.projecttask.servicelayer.ProjectTasksListLayer;
import com.entities.projecttaskpriority.servicelayer.TaskPriorityServiceLayer;
import com.entities.projecttaskresolution.servicelayer.TaskResolutionServiceLayer;
import com.entities.projecttaskstatus.servicelayer.TaskStatusServiceLayer;
import com.entities.projecttasktype.servicelayer.TaskTypeServiceLayer;
import com.entities.projectteam.servicelayer.TeamMemberListLayer;
import com.entities.projectversion.servicelayer.VersionListLayer;
import com.model.KeyValue;
import com.model.project.ProjectTask;
import com.model.project.TeamMember;
import com.model.project.Version;
import com.model.project.attributes.TaskPriority;
import com.model.project.attributes.TaskResolution;
import com.model.project.attributes.TaskStatus;
import com.model.project.attributes.TaskType;
import com.model.user.User;
import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;

public class TaskDetailController
        extends HibernateDetailController
        implements IDetailTableViewDelegate, IDescriptionViewDelegate, ITabSheetDatasource, IServiceLayerDelegate {


	private String                      taskId;
	private String                      parentProjectId;
	private ProjectTask                 taskItem                           = null;
	private final ProjectTasksListLayer projectTaskListLayer               = new ProjectTasksListLayer();

	private TaskTypeServiceLayer        taskTypeServiceLayer               = null;
	private TaskPriorityServiceLayer    taskPriorityServiceLayer           = null;
	private TaskResolutionServiceLayer  taskResolutionServiceLayer         = null;
	private TaskStatusServiceLayer      taskStatusServiceLayer             = null;
	private TeamMemberListLayer         taskAssigneeServiceLayer           = null;
	private TeamMemberListLayer         taskReporterServiceLayer           = null;
	private VersionListLayer            fixVersionListLayer                = null;
	private VersionListLayer            affectVersionListLayer             = null;

	private final int                   taskTypeFetchRequestUserInfo       = 101;
	private final int                   taskPriorityFetchRequestUserInfo   = 102;
	private final int                   taskResolutionFetchRequestUserInfo = 103;
	private final int                   taskStatusFetchRequestUserInfo     = 104;
	private final int                   taskAssigneeFetchRequestUserInfo   = 105;
	private final int                   taskReporterFetchRequestUserInfo   = 106;
	private final int                   fixVersionFetchRequestUserInfo     = 207;
	private final int                   affectVersionFetchRequestUserInfo  = 208;

	private KeyValueDictionary          taskTypeDictionary                 = null;
	private KeyValueDictionary          taskPriorityDictionary             = null;
	private KeyValueDictionary          taskResolutionDictionary           = null;
	private KeyValueDictionary          taskStatusDictionary               = null;
	private KeyValueDictionary          taskAssigneeDictionary             = null;
	private KeyValueDictionary          taskReporterDictionary             = null;
	private KeyValueDictionary          fixVersionDictionary               = null;
	private KeyValueDictionary          affectVersionDictionary            = null;



	/**
	 * Getters/Setters
	 * 
	 */


	public String getTaskId () {

		return taskId;
	}



	public void setTaskId ( String taskId ) {

		this.taskId = taskId;
	}



	public String getParentProjectId () {

		return parentProjectId;
	}



	public void setParentProjectId ( String parentProjectId ) {

		this.parentProjectId = parentProjectId;
	}



	/**
	 * 
	 * task priority
	 */

	private <T> void taskPriorityResponseItems ( List <T> items ) {

		taskPriorityDictionary = new KeyValueDictionary();
		taskPriorityDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			TaskPriority taskPriority = (TaskPriority) iterator.next();
			taskPriorityDictionary.put(String.format("%d", taskPriority.getId()), taskPriority.getName());
		}

	}



	private void taskPriorityPerformFetch () {

		taskPriorityServiceLayer = new TaskPriorityServiceLayer();
		taskPriorityServiceLayer.setUserInfo(Integer.valueOf(taskPriorityFetchRequestUserInfo));
		taskPriorityServiceLayer.setLayerDelegate(this);
		taskPriorityServiceLayer.performRequestWithFilter(null, null);
	}



	private String taskPriorityCell ( ProjectTask taskItem,
	                                  boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			TaskPriority taskPriority = taskItem.getTaskPriority();
			if ( taskPriority != null ) {
				String id = String.format("%d", taskPriority.getId());
				String name = taskPriority.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.taskPriority");
		result = this.selectControl("taskPriority", caption, propertyValue, taskPriorityDictionary, readOnly);
		return result;

	}



	/**
	 * 
	 * task type
	 */

	private <T> void taskTypeResponseItems ( List <T> items ) {

		taskTypeDictionary = new KeyValueDictionary();
		taskTypeDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			TaskType taskType = (TaskType) iterator.next();
			taskTypeDictionary.put(String.format("%d", taskType.getId()), taskType.getName());
		}

	}



	private void taskTypePerformFetchItems () {

		taskTypeServiceLayer = new TaskTypeServiceLayer();
		taskTypeServiceLayer.setUserInfo(Integer.valueOf(taskTypeFetchRequestUserInfo));
		taskTypeServiceLayer.setLayerDelegate(this);
		taskTypeServiceLayer.performRequestWithFilter(null, null);

	}



	private String taskCreationDateCell ( ProjectTask taskItem,
	                                      boolean readOnly ) {

		String result = null;
		String propertyValue = null;
		Date createDate = null;
		if (taskItem != null) {
			createDate = taskItem.getCreateDate();
		}

		if (createDate == null) {
			createDate = new Date();
		}

		try {
			final DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
			final Calendar cal = dateFormat.getCalendar();
			cal.setLenient(false);
			dateFormat.setCalendar(cal);
			propertyValue = dateFormat.format(createDate);

		} catch (ParseException e) {

		}

		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.createDate");
		result = this.inputControl("createDate", caption, propertyValue, readOnly);
		return result;
	}



	private String taskAssigneeCellProjectTask ( ProjectTask taskItem,
	                                             boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			User assignee = taskItem.getAssignee();
			if ( assignee != null ) {
				String id = String.format("%d", assignee.getId());
				String name = assignee.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.assignee");
		result = this.selectControl("assignee", caption, propertyValue, taskAssigneeDictionary, readOnly);
		return result;
	}



	private String taskReporterCellProjectTask ( ProjectTask taskItem,
	                                             boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			User reporter = taskItem.getReporter();
			if ( reporter != null ) {
				String id = String.format("%d", reporter.getId());
				String name = reporter.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.reporter");
		result = this.selectControl("reporter", caption, propertyValue, taskReporterDictionary, readOnly);
		return result;
	}



	private String taskTypeCell ( ProjectTask taskItem,
	                              boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			TaskType taskType = taskItem.getTaskType();
			if ( taskType != null ) {
				String id = String.format("%d", taskType.getId());
				String name = taskType.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.taskType");
		result = this.selectControl("taskType", caption, propertyValue, taskTypeDictionary, readOnly);
		return result;
	}



	/**
	 * 
	 * task resolution
	 */

	private <T> void taskResolutionResponseItems ( List <T> items ) {

		taskResolutionDictionary = new KeyValueDictionary();
		taskResolutionDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			TaskResolution taskResolution = (TaskResolution) iterator.next();
			taskResolutionDictionary.put(String.format("%d", taskResolution.getId()), taskResolution.getName());
		}

	}



	private void taskResolutionPerformFetchItems () {

		taskResolutionServiceLayer = new TaskResolutionServiceLayer();
		taskResolutionServiceLayer.setUserInfo(Integer.valueOf(taskResolutionFetchRequestUserInfo));
		taskResolutionServiceLayer.setLayerDelegate(this);
		taskResolutionServiceLayer.performRequestWithFilter(null, null);

	}



	private void taskAssigneePerformFetchItems () {

		String whereClause = null;

		Set <HibernateParameter> params = new HashSet <HibernateParameter>();
		if ( this.parentProjectId != null ) {
			try {
				Integer parentTaskId = Integer.parseInt(this.parentProjectId);
				params.add(new HibernateParameter("ID", parentTaskId));
				whereClause = "where parentProject.id=:ID";
			} catch ( NumberFormatException e ) {
				whereClause = null;
			}
		}

		taskAssigneeServiceLayer = new TeamMemberListLayer();
		taskAssigneeServiceLayer.setUserInfo(Integer.valueOf(taskAssigneeFetchRequestUserInfo));
		taskAssigneeServiceLayer.setLayerDelegate(this);
		taskAssigneeServiceLayer.performRequestWithFilter(whereClause, params);

	}



	private <T> void taskAssigneeResponseItems ( List <T> items ) {

		taskAssigneeDictionary = new KeyValueDictionary();
		taskAssigneeDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			TeamMember teamMember = (TeamMember) iterator.next();
			User assignee = teamMember.getTeamMemberCategory().getUser();
			taskAssigneeDictionary.put(String.format("%d", assignee.getId()), assignee.getName());
		}

	}



	private <T> void taskReporterResponseItems ( List <T> items ) {

		taskReporterDictionary = new KeyValueDictionary();
		taskReporterDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			TeamMember teamMember = (TeamMember) iterator.next();
			User reporter = teamMember.getTeamMemberCategory().getUser();
			taskReporterDictionary.put(String.format("%d", reporter.getId()), reporter.getName());
		}

	}



	private void taskReporterPerformFetchItems () {

		String whereClause = null;
		Set <HibernateParameter> params = new HashSet <HibernateParameter>();
		if ( this.parentProjectId != null ) {
			try {
				Integer parentTaskId = Integer.parseInt(this.parentProjectId);
				params.add(new HibernateParameter("ID", parentTaskId));
				whereClause = "where parentProject.id=:ID";
			} catch ( NumberFormatException e ) {
				whereClause = null;
			}
		}

		taskReporterServiceLayer = new TeamMemberListLayer();
		taskReporterServiceLayer.setUserInfo(Integer.valueOf(taskReporterFetchRequestUserInfo));
		taskReporterServiceLayer.setLayerDelegate(this);
		taskReporterServiceLayer.performRequestWithFilter(whereClause, params);

	}



	private void fixVersionPerformFetchItems () {

		String whereClause = null;
		if ( parentProjectId != null ) {
			whereClause = String.format("where parentProject.id=%s", parentProjectId);
		}

		fixVersionListLayer = new VersionListLayer();
		fixVersionListLayer.setUserInfo(Integer.valueOf(fixVersionFetchRequestUserInfo));
		fixVersionListLayer.setLayerDelegate(this);
		fixVersionListLayer.performRequestWithFilter(whereClause, null);

	}



	private void affectVersionPerformFetchItems () {

		String whereClause = null;
		if ( parentProjectId != null ) {
			whereClause = String.format("where parentProject.id=%s", parentProjectId);
		}

		affectVersionListLayer = new VersionListLayer();
		affectVersionListLayer.setUserInfo(Integer.valueOf(affectVersionFetchRequestUserInfo));
		affectVersionListLayer.setLayerDelegate(this);
		affectVersionListLayer.performRequestWithFilter(whereClause, null);

	}



	private <T> void projectFixVersionResponseItems ( List <T> items ) {

		if ( items == null ) {
			return;
		}

		fixVersionDictionary = new KeyValueDictionary();
		fixVersionDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			Version version = (Version) iterator.next();
			fixVersionDictionary.put(String.format("%d", version.getId()), version.getName());
		}

	}



	private <T> void projectAffectVersionResponseItems ( List <T> items ) {

		if ( items == null ) {
			return;
		}
		affectVersionDictionary = new KeyValueDictionary();
		affectVersionDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			Version version = (Version) iterator.next();
			affectVersionDictionary.put(String.format("%d", version.getId()), version.getName());
		}

	}



	private String taskResolutionCell ( ProjectTask taskItem,
	                                    boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			TaskResolution taskResolution = taskItem.getTaskResolution();
			if ( taskResolution != null ) {
				String id = String.format("%d", taskResolution.getId());
				String name = taskResolution.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.taskResolution");
		result = this.selectControl("taskResolution", caption, propertyValue, taskResolutionDictionary, readOnly);
		return result;
	}



	/**
	 * 
	 * task status
	 */

	private <T> void taskStatusResponseItems ( List <T> items ) {

		taskStatusDictionary = new KeyValueDictionary();
		taskStatusDictionary.put(null, "-");
		Iterator <T> iterator = items.iterator();
		while ( iterator.hasNext() ) {
			TaskStatus taskStatus = (TaskStatus) iterator.next();
			taskStatusDictionary.put(String.format("%d", taskStatus.getId()), taskStatus.getName());
		}

	}



	private void taskStatusPerformFetchItems () {

		taskStatusServiceLayer = new TaskStatusServiceLayer();
		taskStatusServiceLayer.setUserInfo(Integer.valueOf(taskStatusFetchRequestUserInfo));
		taskStatusServiceLayer.setLayerDelegate(this);
		taskStatusServiceLayer.performRequestWithFilter(null, null);

	}



	private String taskStatusCell ( ProjectTask taskItem,
	                                boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			TaskStatus taskStatus = taskItem.getTaskStatus();
			if ( taskStatus != null ) {
				String id = String.format("%d", taskStatus.getId());
				String name = taskStatus.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.taskStatus");
		result = this.selectControl("taskStatus", caption, propertyValue, taskStatusDictionary, readOnly);
		return result;
	}



	/**
	 * ServiceLayer Delegate
	 * 
	 */
	@Override
	public <T> void responseResponseItemsList ( final List <T> items,
	                                            final Object request,
	                                            final Exception exception ) {

		if ( request == null ) {
			return;
		}

		HibernateServiceLayer serviceLayer = (HibernateServiceLayer) request;
		Integer userInfo = (Integer) serviceLayer.getUserInfo();
		if ( userInfo == null ) {
			return;
		}


		switch ( userInfo ) {
			case taskTypeFetchRequestUserInfo: {
				this.taskTypeResponseItems(items);
				break;
			}
			case taskPriorityFetchRequestUserInfo: {
				this.taskPriorityResponseItems(items);
				break;
			}
			case taskResolutionFetchRequestUserInfo: {
				this.taskResolutionResponseItems(items);
				break;
			}
			case taskStatusFetchRequestUserInfo: {
				this.taskStatusResponseItems(items);
				break;
			}
			case taskAssigneeFetchRequestUserInfo: {
				this.taskAssigneeResponseItems(items);
				break;
			}
			case taskReporterFetchRequestUserInfo: {
				this.taskReporterResponseItems(items);
				break;
			}
			case fixVersionFetchRequestUserInfo: {
				this.projectFixVersionResponseItems(items);
				break;
			}
			case affectVersionFetchRequestUserInfo: {
				this.projectAffectVersionResponseItems(items);
				break;
			}
			default: {
				break;
			}
		}

	}



	/**
	 * ICustomDatasource
	 * 
	 * 
	 * 
	 */

	@Override
	public void reloadData () {

		Integer result = null;
		try {
			result = Integer.parseInt(this.taskId);
		} catch ( NumberFormatException e ) {
			result = null;
		}

		taskItem = (ProjectTask) projectTaskListLayer.objectByUNID(result, null, this);

		if ( taskItem != null ) {
			this.parentProjectId = null;
			if ( taskItem.getParentProject() != null ) {
				this.parentProjectId = taskItem.getParentProject().idValue().getValue();
			}
		}



		this.taskTypePerformFetchItems();

		this.taskPriorityPerformFetch();

		this.taskResolutionPerformFetchItems();

		this.taskStatusPerformFetchItems();

		this.taskAssigneePerformFetchItems();

		this.taskReporterPerformFetchItems();

		this.fixVersionPerformFetchItems();

		this.affectVersionPerformFetchItems();


	}



	@Override
	public void setCustomDatasourceDelegate ( ICustomDatasourceDelegate delegate ) {

	}



	/**
     *
     *
     *
     *
     */

	@Override
	public int tabSheetCellsCount () {


		return 0;
	}



	@Override
	public TabSheetItemCell tabSheetCellAtIndex ( int index ) {


		return null;
	}



	@Override
	public String tabsPanelStyleClassName () {


		return null;
	}



	@Override
	public String descriptionData () {


		return null;
	}



	@Override
	public int detailTableViewItemsCount ( String userInfo ) {

		int result = 0;
		if ( "BASE".equalsIgnoreCase(userInfo) ) {
			result = 2;
		} else if ( "ATTRIBUTES".equalsIgnoreCase(userInfo) ) {
			result = 6;
		} else if ( "PEOPLE".equalsIgnoreCase(userInfo) ) {
			result = 2;
		} else if ( "DATES".equalsIgnoreCase(userInfo) ) {
			result = 1;
		}
		return result;
	}



	@Override
	public String detailTableViewItemAtIndex ( String userInfo,
	                                           int index ) {

		String result = null;
		if ( userInfo.equalsIgnoreCase("BASE") ) {
			result = this.taskBaseItemAtIndex(index);
		} else if ( userInfo.equalsIgnoreCase("ATTRIBUTES") ) {
			result = this.taskDetailItemAtIndex(index);
		} else if ( userInfo.equalsIgnoreCase("PEOPLE") ) {
			result = this.taskPeopleItemAtIndex(index);
		} else if ( userInfo.equalsIgnoreCase("DATES") ) {
			result = this.taskDatesItemAtIndex(index);
		} else {

		}
		return result;
	}



	private String taskPeopleItemAtIndex ( int index ) {

		String result = null;
		String style = null;
		String data = null;
		boolean readOnly = this.isReadOnly();

		switch ( index ) {
			case 0: {
				style = "-single";
				data = this.taskAssigneeCellProjectTask(taskItem, readOnly);
				break;
			}
			case 1: {
				style = "-single";
				data = this.taskReporterCellProjectTask(taskItem, readOnly);
				break;
			}
			default: {
				break;
			}
		}
		result = String.format("<li class=\"property-item%s\"><div class=\"wrap\">%s</li>", style, data);
		return result;

	}



	private String taskDatesItemAtIndex ( int index ) {

		String result = null;
		String style = null;
		String data = null;
		boolean readOnly = this.isReadOnly();

		switch ( index ) {
			case 0: {
				style = "-single";
				data = this.taskCreationDateCell(taskItem, readOnly);
				break;
			}
			// case 1: {
			// style = "-single";
			// data = this.taskReporterCellProjectTask(taskItem, readOnly);
			// break;
			// }
			default: {
				break;
			}
		}
		result = String.format("<li class=\"property-item%s\"><div class=\"wrap\">%s</li>", style, data);
		return result;

	}



	private String taskDetailItemAtIndex ( int index ) {

		String result = null;
		String style = null;
		String data = null;
		boolean readOnly = this.isReadOnly();

		switch ( index ) {
			case 0: {
				style = "-right";
				data = this.taskTypeCell(taskItem, readOnly);
				break;
			}
			case 1: {
				style = "-left";
				data = this.taskPriorityCell(taskItem, readOnly);
				break;
			}
			case 2: {
				style = "-right";
				data = this.taskStatusCell(taskItem, readOnly);
				break;
			}
			case 3: {
				style = "-left";
				data = this.taskResolutionCell(taskItem, readOnly);
				break;
			}
			case 4: {
				style = "-right";
				data = this.taskAffectVersionCell(taskItem, readOnly);
				break;
			}
			case 5: {
				style = "-left";
				data = this.taskFixVersionCell(taskItem, readOnly);
				break;
			}
			default: {
				break;
			}
		}
		result = String.format("<li class=\"property-item%s\"><div class=\"wrap\">%s</li>", style, data);
		return result;
	}



	private String taskBaseItemAtIndex ( int index ) {

		String result = null;
		String style = null;
		String propertyValue = null;
		String data = null;
		boolean readOnly = this.isReadOnly();

		switch ( index ) {
			case 0: {
				style = "-single";
				if ( taskItem != null ) {
					propertyValue = taskItem.getName();
				}
				String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.name");
				data = this.inputControl("name", caption, propertyValue, readOnly);
				break;
			}
			case 1: {
				style = "-single";
				if ( taskItem != null ) {
					propertyValue = taskItem.getDescription();
				}
				String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.description");
				data = this.textAreaControl("description", caption, propertyValue, readOnly);
				break;
			}
			default: {
				break;
			}
		}
		result = String.format("<li class=\"property-item%s\"><div class=\"wrap\">%s</li>", style, data);
		return result;
	}



	/**
     *
     *
     *
     *
     */
	private String taskAffectVersionCell ( ProjectTask projectItem,
	                                       boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			Version version = taskItem.getAffectVersion();
			if ( version != null ) {
				String id = String.format("%d", version.getId());
				String name = version.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.affectVersion");
		result = this.selectControl("affectVersion", caption, propertyValue, affectVersionDictionary, readOnly);
		return result;
	}



	private String taskFixVersionCell ( ProjectTask projectItem,
	                                    boolean readOnly ) {

		String result = null;
		KeyValue propertyValue = null;
		if ( taskItem != null ) {
			Version version = taskItem.getFixVersion();
			if ( version != null ) {
				String id = String.format("%d", version.getId());
				String name = version.getName();
				propertyValue = new KeyValue(id, name);
			}
		}
		String caption = LocalizableString.sharedInstance().localizable("entity.ProjectTask.field.fixVersion");
		result = this.selectControl("fixVersion", caption, propertyValue, fixVersionDictionary, readOnly);
		return result;
	}
}
